<?php
/**
 * @desc 广告位数据层
 * @author kevin.wang
 * @date 2015-01-01 12:00:00
 */
class Adver extends Base
{
	//数据表
	protected $table = 'pert_adver';
	//根据类型查询广告位
	public function getAdver($type = 0)  
    {
		 $table = $this->table;
		 $filed = "`adver_id`,`name`,`image`,`link_url`,`start_time`,`end_time`,`sort`";
		 $sql = "select {$filed} from `{$table}` where `adver_type` = :adver_type and `start_time` < NOW() and `end_time` > NOW() and `delete_flag` = 0 and `is_show` = 0 order by `sort` desc, `adver_id` desc";
		 return $this->select_table($sql, array(":adver_type" => $type));
    } 
}
